#!/usr/bin/perl -w

$id = "$ARGV[0]";     # Service label id
$value = "Error: Comment not found!";   # initializing value

open($file, "<", "ServiceComment.txt") or $value = "Error: ServiceComment.txt not found!";

if ($value =~ "Error: Comment not found!") {

while ($line = <$file>) {   # checks all lines in file

        if($line =~ /^\s*$id\s*=\s*
                    (\"(.+)\"|
                    \'(.+)\')
                    \s*(\#.*)?$/x) 
	{
			if($2) { $value = $2; }
			if($3) { $value = $3; }
	}
}
}

$value =~ s/\"/\\\"/g;
$value =~ s/\'/\\\'/g;

print $value."\n";

close $file;

exit(5);
